Add callback buttons for top command pagination - #291
Open
konard wants to merge 3 commits into
Open
Conversation
Adding CLAUDE.md with task information for AI processing. This file will be removed when the task is complete. Issue: #124
- Implement VkKeyboard utility class for creating VK inline keyboards - Add TopPaginationKeyboard specialized class for top command pagination - Add message_event handler to process callback button events - Modify top command to support pagination with callback buttons - Add send_msg_with_keyboard and send_callback_answer methods - Maintain backward compatibility for top command with number parameter - Support pagination for top, bottom, and people commands - Display 10 users per page with Previous/Next navigation buttons 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
konard
marked this pull request as ready for review
September 12, 2025 23:31
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds callback button pagination to the VK bot's
topcommand as requested in issue #124. Users can now navigate through top users using interactive Previous/Next buttons instead of being limited by message size constraints.🚀 Key Features
top 15) still work without paginationtop,bottom, andpeoplecommands🔧 Technical Implementation
New Components
VkKeyboard Class (
keyboard_utils.py):TopPaginationKeyboard Class (
keyboard_utils.py):Callback Event Handling:
message_eventhandler in main Bot classModified Components
Bot Class (
__main__.py):message_eventhandler for callback buttonssend_msg_with_keyboardmethodsend_callback_answermethodCommands Class (
commands.py):topmethod with pagination logictop_paginatedmethod for paginated displayprocess_callbackandhandle_top_paginationmethods📋 Usage Examples
Basic Commands (New Behavior)
top→ Shows first 10 users with pagination buttonsbottom→ Shows first 10 users from bottom with paginationpeople→ Shows first 10 users with paginationLegacy Commands (Unchanged)
top 15→ Shows exactly 15 users without paginationbottom 5→ Shows exactly 5 users from bottom without paginationPagination Navigation
Users can click:
🧪 Test Plan
simple_keyboard_test.py)demo_callback_buttons.py)📊 Benefits
Fixes #124
🤖 Generated with Claude Code